// TypeScript file
class GameStartView extends egret.Sprite
{
    private gameSoundPop: MusicView;

    constructor()
    {
        super();
        this.initView();
    }

    private initView(): void
    {
        //背景图片
        let bg: egret.Bitmap = ResourceUtils.createBitmapByName("load_bg_png");
        bg.width = Const.SENT_WIDTH;
        bg.height = Const.SENT_HEIGHT;
        this.addChild(bg);

        //开始按钮
        let startBtn: MyButtonForGame = new MyButtonForGame("start_btn_png", "start_btn_png");
        this.addChild(startBtn);
        startBtn.y = Const.SENT_HEIGHT - startBtn.height - 30;
        startBtn.x = Const.SENT_WIDTH / 2 - startBtn.width / 2;
        startBtn.setClick(this.onStartGameHandler.bind(this));
        
        let musicBtn: MyButtonForGame = new MyButtonForGame("music_btn_png", "music_btn_png");
        this.addChild(musicBtn);
        musicBtn.x = startBtn.x + startBtn.width + 10;
        musicBtn.y = startBtn.y + 10;
        musicBtn.setClick(this.showGameSound.bind(this));

        let helpBtn: MyButtonForGame = new MyButtonForGame("help_btn_png", "help_btn_png");
        this.addChild(helpBtn);
        helpBtn.x = startBtn.x - helpBtn.width - 10;
        helpBtn.y = startBtn.y + 10;
        helpBtn.setClick(this.showGameInfoHandler.bind(this));

    }

    private onStartGameHandler(): void
    {
        GameSceneView.gameScene.play();
        this.removeAll();
    }

    private showGameSound(): void
    {

    }

    private showGameInfoHandler(): void
    {

    }

    private removeAll(): void
    {
        this.removeChildren();
        this.gameSoundPop = null;
    }
}